Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed how HTTP headers are ended on Linux #1352

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

maxwalley
Copy link

This is fixing the error reported at https://forum.juce.com/t/url-header-suffix-on-linux/59985/2

Essentially the HTTP header section should end with "/r/n/r/n". The previous code was not taking into account that there might already be some of the suffix present before applying it.

@@ -525,7 +525,14 @@ class WebInputStream::Pimpl
if (userHeaders.isNotEmpty())
header << "\r\n" << userHeaders;

header << "\r\n\r\n";
if(header.toString().endsWith("\r\n"))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sure there's a better to detect \r\n than creating a string copy here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added another commit which uses a reference to a variable.

Copy link

@aminya aminya Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant was the toString call, which I think creates a string copy. It should not matter much as headers should be small.

The actual string literals were fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants